﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Wap/Shop/ShopSite.Master" CodeBehind="BindPhone.aspx.cs" Inherits="ZLCMS.Web.Wap.Member.BindPhone" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>绑定手机</title>
    <link rel="stylesheet" href="/wap/lib/validator-0.7.0/css/jquery.validator.css" />
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/jquery.validator.js"></script>
    <script type="text/javascript" src="/wap/lib/validator-0.7.0/local/zh_CN.js"></script>
    <script src="../lib/jquery/jquery.cookie.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="pages" runat="server">

<div data-role="page" id="mypage">

	<div data-role="header">
	</div><!-- /header -->
    
 	<div role="main" class="ui-content">
        <%if(!string.IsNullOrEmpty(CurrentMember.Phone)){ %>
        <div class="ui-body ui-body-a ui-corner-all">
          <p style="font-size:12px; line-height:20px;">
          您目前已绑定以下手机号码<font color="#089b55">（<%=CurrentMember.Phone%>）</font>，若想更换手机号码，直接输入新的手机号码进行绑定即可！
          </p>
        </div>
        <%} %>
      <div id="login">
        <form id="Form1" data-ajax="false"  command="Member.BindPhone">
            	<div class="loginLIST">
                	<div class="left"><img src="/wap/shop/images/icon_phone.png"></div>
                    <div class="right"><input type="text" id="telephone" placeholder="手机号码" data-rule="required;mobile" command-param='Phone'/></div>
                </div>
                
                    <div class="loginLIST YZM">
                	    <div class="left"><img src="/wap/shop/images/icon_yanzm.png"></div>
                        <div class="center">
                    	    <div class="inputtext"><input type="text" name="checkcode" placeholder="验证码" command-param='CheckCode'
                                    data-rule="required;digits" /></div>
                            <div class="textlink"><input type="button" value="发送验证码" class="sendinput" onclick="SendMsg(this)"></div>
                        </div>
                    </div>
                <div class="button">
                    <a href="javascript:void(0);" id="tb_commit" data-role="button" data-theme="o" data-shadow="false" onclick="executeFormCommonCommand('Form1', bindOk)">确 定</a>           	
                </div>
            </form> 
      </div>
	</div><!-- /content -->
    <div data-role="footer" class="footer" data-position="fixed">
          
    </div>
    <!--footer end-->
</div><!-- /page -->

    <!-- /content -->
    <script type="text/javascript">
        function bindOk(result) {
            showTips("绑定成功", 500, function () {
                location.href = 'Setting.aspx';
            });

        }

        function SendMsg(ct) {
            if ($.trim($("#telephone").val()) == "") {
                showTips("请输入手机号码");
                return;
            }
            var myReg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            if (!myReg.test($("#telephone").val())) {
                showTips("请输入有效的手机号码！");
                return false;
            }
            $(ct).executeCommand({
                successCallBack: function (result) {
                    if (result) {
                        if (result.Status == 1) {
                            showTips("验证码发送成功，请注意查收。");
                            $(ct).button({ disabled: true });
                            var counter = 60;
                            var timer = setInterval(function () {
                                if (counter > 0) {
                                    $(ct).val(counter + "秒后重发");
                                    $(ct).button("refresh");

                                    counter--;
                                }
                                else {
                                    $(ct).val("发送验证码");
                                    $(ct).button("refresh");
                                    $(ct).button({ disabled: false });
                                    clearInterval(timer);
                                }
                            }, 1000);
                        }
                        else {
                            showTips("发送验证码失败");
                        }
                    }
                },
                errorCallback: function (errorCode, msg) {
                    showTips(msg);
                }
            }, 'Pub.SendCheckCode', { Phone: $.trim($("#telephone").val()) });
        }
    </script>


</asp:Content>
